﻿namespace OutLook.Model.Domains
{
    using System.Runtime.Serialization;

    /// <summary>
    /// TODO: Nastya.
    /// </summary>
    [DataContract]
    public class LossRowToLoad
    {
        #region Constructors

        /// <summary>
        /// Initializes new default instance of LossRowToLoad
        /// </summary>
        private LossRowToLoad() : this(Loss.Create(), 0.0d) { }

        /// <summary>
        /// Initializes new instance of LossRowToLoad
        /// </summary>
        /// <param name="charge">TODO:Nastya</param>
        /// <param name="weight">TODO:Nastya</param>
        private LossRowToLoad(Loss loss, double weight)
        {
            Loss = loss;
            Weight = weight;
        }

        #endregion

        #region Properties

        /// <summary>
        /// TODO:Nastya
        /// </summary>
        [DataMember(Order = 1)]
        public Loss Loss { get; set; }

        /// <summary>
        /// TODO:Nastya
        /// </summary>
        [DataMember(Order = 2)]
        public double Weight { get; set; }

        #endregion

        #region Factory Method

        /// <summary>
        /// Creates new default instance of LossRowToLoad 
        /// </summary>
        /// <returns>New default instance of LossRowToLoad </returns>
        public static LossRowToLoad Create()
        {
            return new LossRowToLoad();
        }

        /// <summary>
        /// Creates new instance of LossRowToLoad 
        /// </summary>
        /// <param name="charge">TODO:Nastya</param>
        /// <param name="weight">TODO:Nastya</param>
        /// <returns>New instance of LossRowToLoad </returns>
        /// <remarks>Can return NULL if input arguments were wrong</remarks>
        public static LossRowToLoad Create(Loss loss, double weight)
        {
            if (loss == null)
                return null;

            return new LossRowToLoad(loss, weight);
        }

        #endregion
    }
}
